<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                template="./template/template_padrao.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:g7="http://java.sun.com/jsf/composite/g7">

    <ui:define name="conteudo">
        <p:panel header="Manutenção de Backlog">           
            <h:form id="formBacklog">
                <p:messages id="msgInicial"/>
                <p:commandButton value="Adicionar" icon="ui-icon-plus" onclick="dlgBacklog.show();" update=":cadastrarBacklog:outputPanelBacklog"
                                 action="#{backlogController.limpar()}"/>
                <p:separator style="margin:10px 0;"/>
                <p:dataTable id="dataTableBacklog" var="backlog" value="#{backlogController.backlogs}" emptyMessage="Nenhum Registro Encontrado"
                             paginator="true" rows="5" paginatorPosition="bottom">                    
                    <p:column headerText="Descrição" sortBy="#{backlog.descricao}">
                        <h:outputText value="#{backlog.descricao}"/>
                    </p:column>
                    <p:column headerText="Produto">
                        <h:outputText value="#{backlog.produto.nome}"/>
                    </p:column>
                    <p:column headerText="Como demonstra" sortBy="#{backlog.comoDemonstrar}">
                        <h:outputText value="#{backlog.comoDemonstrar}"/>
                    </p:column>
                    <p:column headerText="Notas" sortBy="#{backlog.notas}">
                        <h:outputText value="#{backlog.notas}"/>
                    </p:column>
                    <p:column headerText="Estimativas" sortBy="#{backlog.estimativa}">
                        <h:outputText value="#{backlog.estimativa}"/>
                    </p:column>

                    <p:column headerText="Ações">
                        <p:commandButton icon="ui-icon-pencil" title="Editar" onclick="dlgBacklog.show()" update=":cadastrarBacklog:outputPanelBacklog">
                            <f:setPropertyActionListener target="#{backlogController.backlog}" value="#{backlog}"/>
                        </p:commandButton>
                        <p:commandButton icon="ui-icon-trash" title="Excluir" onclick="confirmation.show()">
                            <f:setPropertyActionListener target="#{backlogController.backlog}" value="#{backlog}"/>
                        </p:commandButton>
                    </p:column>
                </p:dataTable> 
            </h:form>
        </p:panel>

        <g7:cadastrarBacklog id="cadastrarBacklog"/>


        <h:form prependId="false">
            <p:confirmDialog id="confirmDialog" message="Tem certeza que deseja excluir esse dado?"  
                             header="Exclusão" severity="alert" widgetVar="confirmation">  

                <p:commandButton id="confirm" value="Sim" oncomplete="confirmation.hide()"  
                                 actionListener="#{backlogController.remover()}" update=":formBacklog" />  
                <p:commandButton id="decline" value="Não" onclick="confirmation.hide();" type="button" />   

            </p:confirmDialog>  
        </h:form>

    </ui:define>
</ui:composition>